void main(List<String> args) {
  Person person = Person.fromJson({'name': '张三', 'age': 18});
  print('${person.name}  ${person.age}');
}

class Person {
  String? name;
  int? age;

  Person({this.name, this.age});

//工厂模式
  factory Person.fromJson(Map<String, dynamic> json) {
    return Person(name: json['name'], age: json['age']);
  }
}
